package com.sea.base.json.typeAdapter

import com.google.gson.TypeAdapter
import com.google.gson.stream.JsonReader
import com.google.gson.stream.JsonWriter

class DefLongTypeAdapter : TypeAdapter<Long>() {
    private val typeName = "long"
    override fun write(out: JsonWriter, value: Long?) {
        out.value(value)
    }

    override fun read(inReader: JsonReader?): Long? {
        return readNumber(inReader, typeName, { it.toLong() }, { it.asLong })
    }
}